package summer_vacation.xuqianlan;
import java.util.Scanner;
/**
 * Created by lenovo on 2015/9/3.
 */
public class Test_32 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("please input four bite number:");
        int n=input.nextInt();
        int a=n/1000;
        int b=(n-a*1000)/100;
        int c=(n-a*1000-b*100)/10;
        int d=n-a*1000-b*100-c*10;
        int h=a*a+b*b+c*c+d*d;
        System.out.println(+h);
    }
}
